<!--
  -    Copyright (c) 2018-2025, hycloud All rights reserved.
  -
  - Redistribution and use in source and binary forms, with or without
  - modification, are permitted provided that the following conditions are met:
  -
  - Redistributions of source code must retain the above copyright notice,
  - this list of conditions and the following disclaimer.
  - Redistributions in binary form must reproduce the above copyright
  - notice, this list of conditions and the following disclaimer in the
  - documentation and/or other materials provided with the distribution.
  - Neither the name of the pig4cloud.com developer nor the names of its
  - contributors may be used to endorse or promote products derived from
  - this software without specific prior written permission.
  - Author: hycloud
  -->
<template>
    <div class="execution housing-table">
        <basic-container>
            <avue-crud ref="crud"
                       :page.sync="page"
                       :data="tableData"
                       :permission="permissionList"
                       :table-loading="tableLoading"
                       :option="tableOption"
                       @on-load="getList"
                       class="tableClass"
                       @search-change="searchChange"
                       @refresh-change="refreshChange"
                       @size-change="sizeChange"
                       @current-change="currentChange"
                       @row-update="handleUpdate"
                       @row-save="handleSave"
                       @row-del="rowDel">
                       <template slot="menuLeft" v-if="addBtn">
                            <el-button
                            icon="el-icon-circle-plus"
                            size="small"
                            type="primary"
                            @click="addNodeform('housing_bill_apply')">住房申请</el-button>
                            <!-- <el-button
                            icon="el-icon-circle-plus"
                            size="small"
                            type="primary"
                            @click="handleform">交接</el-button> -->
                        </template>
                        <template slot="menu" slot-scope="scope">
                            <el-button type="text"
                            size="small"
                            @click="goDetail(scope)">详情</el-button>
                            <el-button type="text"
                            size="small"
                            v-if="scope.row.bizStatus === '2' && permissions.act_housingresident_handle"
                            @click="handleform(scope)">入住</el-button>
                            <el-button type="text"
                            size="small"
                            v-if="scope.row.bizStatus === '1' && permissions.act_housingresident_handle"
                            @click="handleform(scope)">退房</el-button>
                            <el-button type="text"
                            size="small"
                            v-if="scope.row.bizStatus === '0' && scope.row.status === '2'"
                            @click="handleform1(scope)">交接详情</el-button>
                        </template>
            </avue-crud>
        </basic-container>
        <el-dialog
            :visible.sync="modal"
            v-if="modal"
            title=""
            width="1080px"
            top="0"
            class="flow-dialog"
            :close-on-click-modal="false"
            append-to-body>
            <div class="form-designer">
                <render-form
                   :option="option" :formObj="formObj" @getModal="getModal"
                ></render-form>
            </div>
        </el-dialog>
        <el-dialog
            :visible.sync="modal1"
            v-if="modal1"
            title="住房实物交接"
            width="1000px"
            top="2vh"
            :close-on-click-modal="false"
            append-to-body>
            <div class="form-designer">
               <div class="render-form">
                    <div class="custom-wrap house-form">
                        <div class="header" style="height: 100px; background:#fff;position:relative">
                            <div style="color: #000;font-size: 28px;margin-bottom:15px;">广东省税务局机关公有住房实物交接表</div>
                        </div>
                        <el-form class="form-custom" :model="form" ref="form" label-width="120px">
                            <el-row>
                                <el-col :span="12">
                                    <el-form-item label="姓名">
                                       <span>{{form.residentRealname}}</span>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="12">
                                    <el-form-item label="性别">
                                        <span>{{form.residentSex === '1' ? '男': '女'}}</span>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="12">
                                    <el-form-item label="职务">
                                        <span>{{getZwName(form.residentPost)}}</span>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="12">
                                    <el-form-item label="工作部门">
                                        <span>{{form.residentDeptName}}</span>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="12">
                                    <el-form-item label="身份证号">
                                        <span>{{form.residentCard}}</span>
                                    </el-form-item>
                                </el-col>
                                 <el-col :span="12">
                                    <el-form-item label="联系电话">
                                        <span>{{form.residentPhone}}</span>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="12">
                                    <el-form-item label="人员类别">
                                        <span>{{getReTypeName(form.residentType)}}</span>
                                        </el-select>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="12">
                                   <el-form-item label="住房类型">
                                       <span>{{getHouseTypeName(form.housingType)}}</span>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="24">
                                    <el-form-item label="房屋地址">
                                        <span>{{form.address}}</span>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                        </el-form>
                        <div class="title-block">
                            入住阶段
                        </div>
                        <el-form :model="form1" ref="form1" :rules="rules" label-width="130px">
                            <el-row>
                                <el-col :span="12">
                                    <el-form-item label="钥匙接收数量(把)" prop="doorKey">
                                       <el-input-number v-model="form1 && form1.doorKey" :min="0" :max="10000000" :disabled="form.bizStatus != '2'"></el-input-number>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="12">
                                    <el-form-item label="入住时间" prop="checkDate">
                                        <el-date-picker
                                            v-model="form1 && form1.checkDate"
                                            type="date"
                                             :disabled="form.bizStatus != '2'"
                                            placeholder="请选择入住时间"
                                            value-format="yyyy-MM-dd">
                                        </el-date-picker>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="12">
                                    <el-form-item label="计租时间" prop="leaseDate">
                                        <el-date-picker
                                            v-model="form1 && form1.leaseDate"
                                            type="date"
                                             :disabled="form.bizStatus != '2'"
                                            placeholder="请选择计租时间"
                                            value-format="yyyy-MM-dd">
                                        </el-date-picker>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="12">
                                    <el-form-item label="水表读数(立方)" prop="water">
                                        <el-input-number v-model="form1 && form1.water" :min="0" :max="10000000"  :disabled="form.bizStatus != '2'"></el-input-number>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="12">
                                    <el-form-item label="电表读数(度)" prop="electricity">
                                        <el-input-number v-model="form1 && form1.electricity" :min="0" :max="10000000"  :disabled="form.bizStatus != '2'"></el-input-number>
                                    </el-form-item>
                                </el-col>
                                 <el-col :span="12">
                                    <el-form-item label="煤气读数(立方)" prop="gas">
                                        <el-input-number v-model="form1 && form1.gas" :min="0" :max="10000000"  :disabled="form.bizStatus != '2'"></el-input-number>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="24">
                                    <div class="custom-label">
                                        <label>屋内固定资产</label>
                                    </div>
                                    <div class="custom-content" style="float: left;width:calc(100% - 130px);">
                                        <el-table
                                            ref="stayTable"
                                            @selection-change="handleSelectionChange"
                                            :data="tableData1"
                                            style="width:100%">
                                             <el-table-column
                                                type="selection"
                                                v-if="form.bizStatus == '2'"
                                                width="55">
                                            </el-table-column>
                                            <el-table-column
                                                type="index"
                                                label="序号"
                                                width="50">
                                            </el-table-column>
                                            <el-table-column
                                                prop="no"
                                                label="编号">
                                            </el-table-column>
                                            <el-table-column
                                                prop="name"
                                                label="固定资产名称">
                                            </el-table-column>
                                            <el-table-column
                                                prop="spec"
                                                label="规格">
                                            </el-table-column>
                                            <el-table-column
                                                prop="unit"
                                                label="单位">
                                            </el-table-column>
                                            <el-table-column
                                                prop="brand"
                                                label="品牌">
                                            </el-table-column>
                                        </el-table>
                                    </div>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="24">
                                    <el-form-item label="公租房管理员">
                                       <div>{{form1 && form1.handleRealname}}</div>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="24">
                                    <el-form-item>
                                        <label for="remark" slot="label" style="display: inline-block;height: 100px;line-height:100px;">备注</label>
                                       <el-input type="textarea" style="height: 100px" :row="4" v-model="form1 && form1.remark" :maxlength="200" :disabled="form.bizStatus != '2'"></el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                        </el-form>
                        <div class="title-block" v-if="this.form.bizStatus === '1' || this.form.bizStatus === '0'">
                            退房阶段
                        </div>
                        <el-form :model="form2" ref="form2" label-width="130px" :rules="rules1" v-if="this.form.bizStatus === '1' || this.form.bizStatus === '0'">
                            <el-row>
                                <el-col :span="24">
                                    <el-form-item label="申请退租退房时间" label-width="160px" prop="checkDate">
                                       <el-date-picker
                                            :disabled="form.bizStatus != '1'"
                                            v-model="form2 && form2.checkDate"
                                            type="date"
                                            placeholder="请选择退租退房时间"
                                            value-format="yyyy-MM-dd">
                                        </el-date-picker>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="12">
                                    <el-form-item label="钥匙归还数量(把)" prop="doorKey">
                                       <el-input-number :disabled="form.bizStatus != '1'" v-model="form2 && form2.doorKey" :min="0" :max="10000000"></el-input-number>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="12">
                                    <el-form-item label="归还时间" prop="returnDate">
                                        <el-date-picker
                                            v-model="form2 && form2.returnDate"
                                            type="date"
                                            :disabled="form.bizStatus != '1'"
                                            placeholder="请选择归还时间"
                                            value-format="yyyy-MM-dd">
                                        </el-date-picker>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row class="no-border">
                                 <el-form-item label-width="131px">
                                    <label slot="label" style="width: 100%;display: inline-block;height: 153px;line-height:153px;border-left: 1px solid #000;border-top: 1px solid #000;">费用清缴情况</label>
                                    <el-col :span="24">
                                        <el-row>
                                            <el-col :span="12">
                                                <el-form-item label="租金是否缴清：" prop="rentPaid">
                                                    <el-radio-group v-model="form2 && form2.rentPaid" :disabled="form.bizStatus != '1'" style="margin-left: 20px">
                                                        <el-radio :label="'1'">是</el-radio>
                                                        <el-radio :label="'0'">否</el-radio>
                                                    </el-radio-group>
                                                </el-form-item>
                                            </el-col>
                                            <el-col :span="12" style="border-left: 1px solid #000">
                                                <el-form-item label="水表读数(立方)" prop="water">
                                                     <el-input-number v-model="form2 && form2.water" :disabled="form.bizStatus != '1'" :min="0" :max="10000000"></el-input-number>
                                                </el-form-item>
                                            </el-col>
                                        </el-row>
                                        <el-row>
                                            <el-col :span="12">
                                                <el-form-item label="电表读数(度)" prop="electricity">
                                                    <el-input-number v-model="form2 && form2.electricity" :disabled="form.bizStatus != '1'" :min="0" :max="10000000"></el-input-number>
                                                </el-form-item>
                                            </el-col>
                                            <el-col :span="12" style="border-left: 1px solid #000">
                                                <el-form-item label="煤气读数(立方)" prop="gas">
                                                    <el-input-number v-model="form2 && form2.gas" :min="0" :disabled="form.bizStatus != '1'" :max="10000000"></el-input-number>
                                                </el-form-item>
                                            </el-col>
                                        </el-row>
                                        <el-row>
                                            <el-col :span="24">
                                                <el-form-item label="各规费(物管费、水电费)是否缴清：" label-width="250px" prop="feePaid">
                                                    <el-radio-group v-model="form2 && form2.feePaid" :disabled="form.bizStatus != '1'" style="margin-left: 20px">
                                                        <el-radio :label="'1'">是</el-radio>
                                                        <el-radio :label="'0'">否</el-radio>
                                                    </el-radio-group>
                                                </el-form-item>
                                            </el-col>
                                        </el-row>
                                    </el-col>
                                 </el-form-item>
                            </el-row>
                            <el-row>
                                <el-col :span="24">
                                    <div class="custom-label">
                                        <label>屋内固定资产</label>
                                    </div>
                                    <div class="custom-content" style="float: left;width:calc(100% - 130px);">
                                        <el-table
                                            :data="tableData2"
                                            @selection-change="handleSelectionChange"
                                            style="width: 100%">
                                             <el-table-column
                                                type="selection"
                                                v-if="form.bizStatus == '1'"
                                                width="55">
                                            </el-table-column>
                                            <el-table-column
                                                type="index"
                                                label="序号"
                                                width="50">
                                            </el-table-column>
                                            <el-table-column
                                                prop="no"
                                                label="编号">
                                            </el-table-column>
                                            <el-table-column
                                                prop="name"
                                                label="固定资产名称">
                                            </el-table-column>
                                            <el-table-column
                                                prop="spec"
                                                label="规格">
                                            </el-table-column>
                                            <el-table-column
                                                prop="unit"
                                                label="单位">
                                            </el-table-column>
                                            <el-table-column
                                                prop="brand"
                                                label="品牌">
                                            </el-table-column>
                                        </el-table>
                                    </div>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="24">
                                    <el-form-item label="公租房管理员">
                                       <div>{{form1 && form1.handleRealname}}</div>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="24">
                                    <el-form-item>
                                        <label for="remark" slot="label" style="display: inline-block;height: 100px;line-height:100px;">备注</label>
                                       <el-input type="textarea" style="height: 100px" :row="4" :disabled="form.bizStatus != '1'" v-model="form2 && form2.remark" :maxlength="200"></el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                        </el-form>
                    </div>
               </div>
            </div>
            <div class="btn-footer">
                <el-button type="primary" @click="dataSubmit" v-if="this.form.bizStatus == '1' || this.form.bizStatus == '2'">确 定</el-button>
                <el-button @click="close1">取 消</el-button>
            </div>
        </el-dialog>
          <el-dialog
            :visible.sync="modal3"
            v-if="modal3"
            title="住房实物交接"
            width="1000px"
            top="2vh"
            :close-on-click-modal="false"
            append-to-body>
            <div class="form-designer">
               <div class="render-form">
                    <div class="custom-wrap house-form">
                        <div class="header" style="height: 100px; background:#fff;position:relative">
                            <div style="color: #000;font-size: 28px;margin-bottom:15px;">广东省税务局机关公有住房实物交接表</div>
                        </div>
                        <el-form class="form-custom" :model="form" ref="form" label-width="120px">
                            <el-row>
                                <el-col :span="12">
                                    <el-form-item label="姓名">
                                       <span>{{form.residentRealname}}</span>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="12">
                                    <el-form-item label="性别">
                                        <span>{{form.residentSex === '1' ? '男': '女'}}</span>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="12">
                                    <el-form-item label="职务">
                                        <span>{{getZwName(form.residentPost)}}</span>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="12">
                                    <el-form-item label="工作部门">
                                        <span>{{form.residentDeptName}}</span>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="12">
                                    <el-form-item label="身份证号">
                                        <span>{{form.residentCard}}</span>
                                    </el-form-item>
                                </el-col>
                                 <el-col :span="12">
                                    <el-form-item label="联系电话">
                                        <span>{{form.residentPhone}}</span>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="12">
                                    <el-form-item label="人员类别">
                                        <span>{{getReTypeName(form.residentType)}}</span>
                                        </el-select>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="12">
                                   <el-form-item label="住房类型">
                                       <span>{{getHouseTypeName(form.housingType)}}</span>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="24">
                                    <el-form-item label="房屋地址">
                                        <span>{{form.address}}</span>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                        </el-form>
                        <div class="title-block">
                            入住阶段
                        </div>
                        <el-form :model="form1" ref="form1" label-width="130px">
                            <el-row>
                                <el-col :span="12">
                                    <el-form-item label="钥匙接收数量(把)" prop="doorKey">
                                       <el-input-number v-model="form1 && form1.doorKey" :min="0" :max="10000000" :disabled="form.bizStatus != '2'"></el-input-number>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="12">
                                    <el-form-item label="入住时间" prop="checkDate">
                                        <el-date-picker
                                            v-model="form1 && form1.checkDate"
                                            type="date"
                                             :disabled="form.bizStatus != '2'"
                                            placeholder="请选择入住时间"
                                            value-format="yyyy-MM-dd">
                                        </el-date-picker>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="12">
                                    <el-form-item label="计租时间" prop="leaseDate">
                                        <el-date-picker
                                            v-model="form1 && form1.leaseDate"
                                            type="date"
                                             :disabled="form.bizStatus != '2'"
                                            placeholder="请选择计租时间"
                                            value-format="yyyy-MM-dd">
                                        </el-date-picker>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="12">
                                    <el-form-item label="水表读数(立方)" prop="water">
                                        <el-input-number v-model="form1 && form1.water" :min="0" :max="10000000"  :disabled="form.bizStatus != '2'"></el-input-number>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="12">
                                    <el-form-item label="电表读数(度)" prop="electricity">
                                        <el-input-number v-model="form1 && form1.electricity" :min="0" :max="10000000"  :disabled="form.bizStatus != '2'"></el-input-number>
                                    </el-form-item>
                                </el-col>
                                 <el-col :span="12">
                                    <el-form-item label="煤气读数(立方)" prop="gas">
                                        <el-input-number v-model="form1 && form1.gas" :min="0" :max="10000000"  :disabled="form.bizStatus != '2'"></el-input-number>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="24">
                                    <div class="custom-label">
                                        <label>屋内固定资产</label>
                                    </div>
                                    <div class="custom-content" style="float: left;width:calc(100% - 130px);">
                                        <el-table
                                            ref="stayTable"
                                            @selection-change="handleSelectionChange"
                                            :data="tableData1"
                                            style="width:100%">
                                             <el-table-column
                                                type="selection"
                                                v-if="form.bizStatus == '2'"
                                                width="55">
                                            </el-table-column>
                                            <el-table-column
                                                type="index"
                                                label="序号"
                                                width="50">
                                            </el-table-column>
                                            <el-table-column
                                                prop="no"
                                                label="编号">
                                            </el-table-column>
                                            <el-table-column
                                                prop="name"
                                                label="固定资产名称">
                                            </el-table-column>
                                            <el-table-column
                                                prop="spec"
                                                label="规格">
                                            </el-table-column>
                                            <el-table-column
                                                prop="unit"
                                                label="单位">
                                            </el-table-column>
                                            <el-table-column
                                                prop="brand"
                                                label="品牌">
                                            </el-table-column>
                                        </el-table>
                                    </div>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="24">
                                    <el-form-item label="公租房管理员">
                                       <div>{{form1 && form1.handleRealname}}</div>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="24">
                                    <el-form-item>
                                        <label for="remark" slot="label" style="display: inline-block;height: 100px;line-height:100px;">备注</label>
                                       <el-input type="textarea" style="height: 100px" :row="4" v-model="form1 && form1.remark" :maxlength="200" :disabled="form.bizStatus != '2'"></el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                        </el-form>
                        <div class="title-block" v-if="this.form.bizStatus === '1' || this.form.bizStatus === '0'">
                            退房阶段
                        </div>
                        <el-form :model="form2" ref="form2" label-width="130px" v-if="this.form.bizStatus === '1' || this.form.bizStatus === '0'">
                            <el-row>
                                <el-col :span="24">
                                    <el-form-item label="房屋申请退租退房时间" label-width="160px" prop="checkDate">
                                       <el-date-picker
                                            :disabled="form.bizStatus != '1'"
                                            v-model="form2 && form2.checkDate"
                                            type="date"
                                            placeholder="请选择退租退房时间"
                                            value-format="yyyy-MM-dd">
                                        </el-date-picker>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="12">
                                    <el-form-item label="钥匙归还数量(把)" prop="doorKey">
                                       <el-input-number :disabled="form.bizStatus != '1'" v-model="form2 && form2.doorKey" :min="0" :max="10000000"></el-input-number>
                                    </el-form-item>
                                </el-col>
                                <el-col :span="12">
                                    <el-form-item label="归还时间" prop="returnDate">
                                        <el-date-picker
                                            v-model="form2 && form2.returnDate"
                                            type="date"
                                            :disabled="form.bizStatus != '1'"
                                            placeholder="请选择归还时间"
                                            value-format="yyyy-MM-dd">
                                        </el-date-picker>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row class="no-border">
                                 <el-form-item label-width="131px">
                                    <label slot="label" style="width: 100%;display: inline-block;height: 153px;line-height:153px;border-left: 1px solid #000;border-top: 1px solid #000;">费用清缴情况</label>
                                    <el-col :span="24">
                                        <el-row>
                                            <el-col :span="12">
                                                <el-form-item label="租金是否缴清：" prop="rentPaid">
                                                    <el-radio-group v-model="form2 && form2.rentPaid" :disabled="form.bizStatus != '1'" style="margin-left: 20px">
                                                        <el-radio :label="'1'">是</el-radio>
                                                        <el-radio :label="'0'">否</el-radio>
                                                    </el-radio-group>
                                                </el-form-item>
                                            </el-col>
                                            <el-col :span="12" style="border-left: 1px solid #000">
                                                <el-form-item label="水表读数(立方)" prop="water">
                                                     <el-input-number v-model="form2 && form2.water" :disabled="form.bizStatus != '1'" :min="0" :max="10000000"></el-input-number>
                                                </el-form-item>
                                            </el-col>
                                        </el-row>
                                        <el-row>
                                            <el-col :span="12">
                                                <el-form-item label="电表读数(度)" prop="electricity">
                                                    <el-input-number v-model="form2 && form2.electricity" :disabled="form.bizStatus != '1'" :min="0" :max="10000000"></el-input-number>
                                                </el-form-item>
                                            </el-col>
                                            <el-col :span="12" style="border-left: 1px solid #000">
                                                <el-form-item label="煤气读数(立方)" prop="gas">
                                                    <el-input-number v-model="form2 && form2.gas" :min="0" :disabled="form.bizStatus != '1'" :max="10000000"></el-input-number>
                                                </el-form-item>
                                            </el-col>
                                        </el-row>
                                        <el-row>
                                            <el-col :span="24">
                                                <el-form-item label="各规费(物管费、水电费)是否缴清：" label-width="250px" prop="feePaid">
                                                    <el-radio-group v-model="form2 && form2.feePaid" :disabled="form.bizStatus != '1'" style="margin-left: 20px">
                                                        <el-radio :label="'1'">是</el-radio>
                                                        <el-radio :label="'0'">否</el-radio>
                                                    </el-radio-group>
                                                </el-form-item>
                                            </el-col>
                                        </el-row>
                                    </el-col>
                                 </el-form-item>
                            </el-row>
                            <el-row>
                                <el-col :span="24">
                                    <div class="custom-label">
                                        <label>屋内固定资产</label>
                                    </div>
                                    <div class="custom-content" style="float: left;width:calc(100% - 120px);">
                                        <el-table
                                            :data="tableData2"
                                            @selection-change="handleSelectionChange"
                                            style="width: 100%">
                                             <el-table-column
                                                type="selection"
                                                v-if="form.bizStatus == '1'"
                                                width="55">
                                            </el-table-column>
                                            <el-table-column
                                                type="index"
                                                label="序号"
                                                width="50">
                                            </el-table-column>
                                            <el-table-column
                                                prop="no"
                                                label="编号">
                                            </el-table-column>
                                            <el-table-column
                                                prop="name"
                                                label="固定资产名称">
                                            </el-table-column>
                                            <el-table-column
                                                prop="spec"
                                                label="规格">
                                            </el-table-column>
                                            <el-table-column
                                                prop="unit"
                                                label="单位">
                                            </el-table-column>
                                            <el-table-column
                                                prop="brand"
                                                label="品牌">
                                            </el-table-column>
                                        </el-table>
                                    </div>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="24">
                                    <el-form-item label="公租房管理员">
                                       <div>{{form1 && form1.handleRealname}}</div>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="24">
                                    <el-form-item>
                                        <label for="remark" slot="label" style="display: inline-block;height: 100px;line-height:100px;">备注</label>
                                       <el-input type="textarea" style="height: 100px" :row="4" :disabled="form.bizStatus != '1'" v-model="form2 && form2.remark" :maxlength="200"></el-input>
                                    </el-form-item>
                                </el-col>
                            </el-row>
                        </el-form>
                    </div>
               </div>
            </div>
            <div class="btn-footer">
                <el-button @click="modal3 = false">取 消</el-button>
            </div>
        </el-dialog>
    </div>
</template>

<script>
    import {fetchList, getObj, addObj, putObj, delObj} from '@/api/housing/oahousingbill'
    import RenderForm from '@/components/table-design/newRender'
    import ViewForm from '@/components/table-design/viewRender'
    import addView from '@/mixins/addView'
    import {stayIn, checkOut, getObj as getObj1} from '@/api/housing/housinghandover'
    import { fetchList as fetchList2 } from '@/api/admin/sysposition'
    import tableHeight from '@/util/tableHeight'
    import { fetchList as fetchList1 } from '@/api/asset/asset'
    import { remote } from "@/api/admin/dict";
    import {tableOption} from '@/const/crud/housing/oahousingbill'
    import {mapGetters} from 'vuex'

    export default {
        name: 'oahousingbill',
        components: { RenderForm, ViewForm },
        mixins: [addView],
        data() {
            return {
                searchForm: {},
                tableData: [],
                tableData1: [],
                tableData2: [],
                option: {},
                optionsHouseType: [],
                optionRylb: [],
                optionsZw: [],
                option1: {},
                modal: false,
                modal1: false,
                modal3: false,
                form: {},
                form1: {},
                assetIds: [],
                form2: {},
                formObj: {
                    code: 'housing_bill_apply',
                    title: '',
                    flag: 'start',
                    bizData: {}
                },
                rules: {
                    doorKey: [
                        { required: true, message: '请输入钥匙接受数量' }
                    ],
                    checkDate: [
                        { required: true, message: '请选择入住时间' }
                    ],
                    leaseDate: [
                        { required: true, message: '请选择计租时间' }
                    ],
                    water: [
                        { required: true, message: '请输入水表读数' }
                    ],
                    electricity: [
                        { required: true, message: '请输入电表读数' }
                    ],
                    gas: [
                        { required: true, message: '请输入煤气读数' }
                    ],
                },
                rules1: {
                    doorKey: [
                        { required: true, message: '请输入钥匙归还数量' }
                    ],
                    checkDate: [
                        { required: true, message: '请选择房屋申请退租退房时间' }
                    ],
                    feePaid: [
                        { required: true, message: '请选择各规费是否缴清' }
                    ],
                    returnDate: [
                        { required: true, message: '请选择归还时间' }
                    ],
                    water: [
                        { required: true, message: '请输入水表读数' }
                    ],
                    electricity: [
                        { required: true, message: '请输入电表读数' }
                    ],
                    gas: [
                        { required: true, message: '请输入煤气读数' }
                    ],
                    rentPaid: [
                        { required: true, message: '请选择租金是否缴清' }
                    ],
                },
                page: {
                    total: 0, // 总页数
                    currentPage: 1, // 当前页数
                    pageSize: 20 // 每页显示多少条
                },
                tableLoading: false,
                tableOption: tableOption
            }
        },
        created() {
            this.init()
            this.eventBusHandle()
        },
        mounted() {
            this.tableOption.height = this.tableHeight() + 10
        },
        computed: {
            ...mapGetters(['permissions', 'userInfo', 'tagList']),
            addBtn() {
                return this.vaildData(this.permissions.act_oahousingbill_add, false)
            },
            permissionList() {
                return {
                    addBtn: false,
                    delBtn: false,
                    editBtn:  false
                };
            }
        },
        methods: {
            eventBusHandle () {
                const _this = this
                eventBus1.$off('changeHeight').$on('changeHeight', function (data) {
                    setTimeout(function(){
                        if (document.getElementsByClassName("el-table")[0]) {
                            document.getElementsByClassName("el-table")[0].style.height = _this.tableHeight() + 10 + 'px'
                        }
                    }, 500)
                })
            },
            init() {
                remote('personnel_type').then(response => {
                    this.optionRylb = response.data.data
                })
                remote('housing_type').then(response => {
                    this.optionsHouseType = response.data.data
                })
                fetchList2({current: 1, size:1000}).then(response => {
                    this.optionsZw = response.data.data.records
                })
            },
            close1() {
                this.modal1 = false
            },
            handleSelectionChange (val) {
                let list = []
                val.map(item => {
                    list.push(item.assetId)
                })
                this.assetIds = list
            },
            dataSubmit() {
                let _this = this
                let formName
                if (this.form.bizStatus === '2') {
                    formName = 'form1'
                } else {
                    formName = 'form2'
                }
                this[formName].bizId = this.form.bizId
                this.$refs[formName].validate((valid) => {
                    if (valid) {
                        // if (_this.assetIds.length) {
                            _this.form1.assetIds = _this.assetIds
                            _this.form2.assetIds = _this.assetIds
                            _this.$confirm('确定提交?', '提示', {
                                confirmButtonText: '确定',
                                cancelButtonText: '取消',
                                type: 'warning'
                            }).then(() => {
                                if(_this.form.bizStatus === '2') {
                                    stayIn(_this.form1).then(response => {
                                        this.$message.success('入住成功')
                                        this.close1()
                                        this.getList(this.page)
                                    })
                                } else {
                                    checkOut(_this.form2).then(response => {
                                        this.$message.success('退房成功')
                                        this.close1()
                                        this.getList(this.page)
                                    })
                                }
                            })
                        // } else {
                        //     _this.$message.error('请勾选固定资产')
                        // }
                    }
                })
            },
            goDetail(scope) {
                let tag = this.tagList.filter(item => {
                    return item.value.indexOf('/db/detail') !== -1
                })
                if (tag.length > 0) {
                    this.$router.$avueRouter.closeTag(tag[0])
                }
                this.$router.push({
                    name: '流程详情',
                    params: {
                        id: scope.row.billId,
                        newtitle: '流程详情-' + scope.row.flowName
                    }
                })
            },
            getZwName(id) {
                let list = this.optionsZw.filter(item => {
                    return item.id === id
                })
                return list.length ? list[0].name : ''
            },
            getReTypeName(id) {
                let list = this.optionRylb.filter(item => {
                    return item.value === id
                })
                return list.length ? list[0].label : ''
            },
            getHouseTypeName(id) {
                let list = this.optionsHouseType.filter(item => {
                    return item.value === id
                })
                return list.length ? list[0].label : ''
            },
            getModal(val) {
                this.modal = val
                this.getList(this.page)
            },
            getList(page, params) {
                this.tableLoading = true
                if (this.searchForm.dateRange) {
                    this.searchForm.startDate = this.searchForm.dateRange[0];
                    this.searchForm.endDate = this.searchForm.dateRange[1];
                }
                fetchList(Object.assign({
                    current: page.currentPage,
                    size: page.pageSize
                }, params, this.searchForm )).then(response => {
                    this.tableData = response.data.data.records
                    this.page.total = response.data.data.total
                    this.tableLoading = false
                }).catch(() => {
                    this.tableLoading=false
                })
            },
            handleform(scope) {
                this.form1 = {}
                this.form2 = {}
                this.form = scope.row
                fetchList1({current: 1, size:1000, areaId: scope.row.areaId, status: '0', bizStatus: '0' }).then(response => {
                    this.tableData1 = response.data.data.records
                })
                // 退房
                if (this.form.bizStatus === '1' || this.form.bizStatus === '0') {
                    getObj1(this.form.bizId).then(response => {
                        this.form1 = response.data.data.stayIn
                        this.tableData1 = response.data.data.stayInAssets
                        this.tableData2 = response.data.data.stayInAssets
                        if(this.form.bizStatus === '0') {
                            this.form2 = response.data.data.checkOut
                            this.tableData2 = response.data.data.checkOutAssets
                        }
                    })
                }
                this.modal1 = true
            },
            handleform1(scope) {
                this.form1 = {}
                this.form2 = {}
                this.form = scope.row
                fetchList1({current: 1, size:1000, areaId: scope.row.areaId, status: '0'}).then(response => {
                    this.tableData1 = response.data.data.records
                })
                // 退房
                if (this.form.bizStatus === '1' || this.form.bizStatus === '0') {
                    getObj1(this.form.bizId).then(response => {
                        this.form1 = response.data.data.stayIn
                        this.tableData1 = response.data.data.stayInAssets
                        this.tableData2 = response.data.data.stayInAssets
                        if(this.form.bizStatus === '0') {
                            this.form2 = response.data.data.checkOut
                            this.tableData2 = response.data.data.checkOutAssets
                        }
                    })
                }
                this.modal3 = true
            },
            rowDel: function (row, index) {
                this.$confirm('是否确认删除?', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(function () {
                    return delObj(row.bizId)
                }).then(data => {
                    this.$message.success('删除成功')
                    this.getList(this.page)
                })
            },
            handleUpdate: function (row, index, done,loading) {
                putObj(row).then(data => {
                    this.$message.success('修改成功')
                    done()
                    this.getList(this.page)
                }).catch(() => {
                    loading();
                });
            },
            handleSave: function (row, done,loading) {
                addObj(row).then(data => {
                    this.$message.success('添加成功')
                    done()
                    this.getList(this.page)
                }).catch(() => {
                    loading();
                });
            },
            sizeChange(pageSize){
                this.page.pageSize = pageSize
            },
            currentChange(current){
                this.page.currentPage = current
            },
            searchChange(form, done) {
                this.searchForm = form
                this.page.currentPage = 1
                this.getList(this.page, form)
                done()
            },
            refreshChange() {
                this.getList(this.page)
            }
        }
    }
</script>
<style lang="scss">
.title-block{   
    height: 60px;
    line-height: 60px;
    text-align: center;
    font-size: 20px;
    font-weight: bold;
    border-left: 1px solid #000;
    border-top: 1px solid #000;
}
.custom-label{
    width: 130px;
    float: left;
    border-right: 1px solid rgb(0, 0, 0);
    position: absolute;
    top: 0;
    bottom: 0;
    left: 1px;
    height: 100%;
    text-align: center;
    label{
        margin-top: 50%;
        display: inline-block;
        height: 100%;
        transform: translateY(-50%);
    }
}
.custom-content{
    display: left;
    margin-left: 130px;
    width: calc(100% - 130px);
}
.form-custom{
    .el-form-item__content{
        span{
            margin-left: 5px;
        }
    }
}
.btn-footer{
    margin: 10px auto;
}
.house-form .el-form-item__content .el-form-item__error{
    right: 40px;
}
</style>